package com.dolphin.config.shiro;

import com.dolphin.Application;
import com.dolphin.commons.JwtToken;
import com.dolphin.commons.JwtUtils;
import com.dolphin.model.User;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * 描述:
 * ${DESCRIPTION}
 *
 * @author 林平
 * @create 2023-05-23 11:47
 * 个人博客地址：https://www.nonelonely.com
 */
public class JWTRealm  {
//    private final static Logger LOGGER = LoggerFactory.getLogger(Application.class);
//
//    public JWTRealm(MyJWTCredentialsMatcher myJWTCredentialsMatcher) {
//        super(myJWTCredentialsMatcher);
//    }
//
//    @Override
//    protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
//
//    }
//
//    @Override
//    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
//        JwtToken jwtToken = (JwtToken) token;
//        String tokenString = jwtToken.getToken();
//        String userName = JwtUtils.getUsername(tokenString);
//        User user = new User();
//        user.setAccount(userName);
//        user.setPermissionList(userName);
//        user.setRole();
//        return new SimpleAuthenticationInfo(user, tokenString, getName());
//    }
//
//    @Override
//    public Class getAuthenticationTokenClass() {
//        return JwtToken.class;
//    }
}
